package com.example.demo.web;

import com.example.demo.pojo.GridMember;
import com.example.demo.service.IGridMemberService;
import com.example.demo.vos.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin("*")
@RestController
@RequestMapping("/gridMember")
public class GridMemberWeb {

    @Autowired
    private IGridMemberService service;

    @RequestMapping("/getAll")
    public ResultVo getUsers() {
        return service.getGmMembers();
    }

    @RequestMapping("/getGridMemberByCodeByPass")
    public ResultVo getGridMemberByCodeByPass( String gmCode, String password) {
        return service.getOne(gmCode, password);
    }

    @RequestMapping("/listGridMemberByProvinceId")
    public ResultVo listGridMemberByProvinceId(Integer provinceId) {
        return service.getGmMembersByProvinceId(provinceId);
    }

    @RequestMapping("/getGridMemberByCodeByPassObj")
    public ResultVo getGridMemberByCodeByPassObj(@RequestBody GridMember gridMember) {
        return service.getGridMemberByCodeByPass(gridMember);
    }

    @RequestMapping("/listGridMemberByCondition")
    public ResultVo listGridMemberByCondition(@RequestBody GridMember gridMember) {
        return service.listGridMemberByProvinceCityState(gridMember);
    }
}